package org.voidness.oje2d;

import java.io.Serializable;

/** A helper function for independence from awt.Dimension */
public class Vector2D implements Serializable {
    /**
     * Comment for <code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 1L;

    /** The vector's X component */
    private int x;

    /** The vector's Y component */
    private int y;

    /**
     * Default constructor.
     * 
     * @param mX The X component
     * @param mY The Y component
     */
    public Vector2D(int mX, int mY) {
        x = mX;
        y = mY;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public String toString() {
        return new String(getX() + "," + getY());
    }

    public Vector2D clone() {
        return new Vector2D(x, y);
    }

    public boolean equals(Object mOther) {
        Vector2D otherVector = (Vector2D) mOther;

        if (otherVector.getX() == getX() && otherVector.getY() == getY())
            return true;

        return false;
    }
}